<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 人类
        function person(name,age){
            this.name=name;
            this.age=age;
        }
        person.prototype.run=function () {
            console.log("我是个人");
        }
        //学生类
        function student(name,age,study){
            person.apply(this,[name,age,study])
            this.study=study
        }
        //将子类的原型变程父类的实例
        student.prototype=new person
        //修正constructor的指向，指向子类的构造函数
        student.prototype.constructor=student
        const ming=new student('明',18,"学习")
        console.log(ming);
        ming.run()
    </script>
</body>
</html>